%------------------------------------------------------------------------
% Program that used to give wrong results.
%
% Model T = {r}, F = {}, U = {p,q}.
%------------------------------------------------------------------------

:- table p/0, q/0, r/0.

p :- tnot(q), r.
q :- r, tnot(q).
r :- tnot(r).
r :- true.

%------------------------------------------------------------------------

test :- p, fail.
test :- ( p ->	( tnot(p) -> writeln('p is undefined (OK)')
		; writeln('p is true') )
	; writeln('p is false') ),
        ( q ->  ( tnot(q) -> writeln('q is undefined (OK)')
		; writeln('q is true') )
	; writeln('q is false') ),
	( r ->  ( tnot(r) -> writeln('r  is undefined')
		; writeln('r is true (OK)') )
	; writeln('r  is false') ).
